module EmployeeJsonSerializer
  def self.as_json employee
    employee.to_json(include: [{employee_certificates: {include:  [:certificate], except: [ :employee_id, :certificate_id]}}, 
                               
                               {contracts: {include: [:contract_type]}}])
  end

  def self.index_json employees
    employees.map { |e| JSON.parse(as_json e) }
  end
end